package com.macro.mall.service.impl;

import com.macro.mall.dto.DesignArticleDto;
import com.macro.mall.mapper.DesignArticleMapper;
import com.macro.mall.model.DesignArticleEntity;
import com.macro.mall.service.DesignArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DesignArticleServiceImpl implements DesignArticleService {

    @Autowired
    private DesignArticleMapper articleMapper;

    @Override
    public int findArticleNum() {
        return articleMapper.findArticleNum();
    }

    @Override
    public List<DesignArticleEntity> findArticleList(Integer curPage, Integer pageSize) {
        Integer skip = (curPage -1) * pageSize;
        return articleMapper.findArticleList(skip,pageSize);
    }

    @Override
    public void addDesignArticle(DesignArticleDto dto) {
        articleMapper.addDesignArticle(dto);
    }

    @Override
    public void updateDesignArticle(DesignArticleDto dto) {
        articleMapper.updateDesignArticle(dto);
    }

    @Override
    public void deleteDesignArticle(Integer id) {
        articleMapper.deleteDesignArticle(id);
    }

    @Override
    public DesignArticleEntity findArticleEntity(Integer id) {
        return articleMapper.findArticleEntity(id);
    }
}
